$(function () {

    window.sgworld = new SmartEarth.SGWorld("cesiumContainer", Cesium, "./static/IMG/earth.jpg", null, function () {
        $('.load-container', parent.document).hide();
        sgworld.Navigate.jumpTo({      //跳转视角
            destination: new Cesium.Cartesian3.fromDegrees(117.57844128806192, 38.35974915512376, 15829)
        });
    });
    window.Viewer = sgworld._Viewer;
    window.Viewer.shadows = false;

    //添加谷歌地图
    var dx = {
        url: "http://www.google.cn/maps/vt?lyrs=s&x={x}&y={y}&z={z}",
        enablePickFeatures: false
    };
    sgworld.Creator.createUrlTemplateImageryProvider("谷歌地图", dx, "0", 1, true, "");
    

    show.model = !show.model;
    viewData.model = sgworld.Creator.create3DTilesets('cangzhou', 'http://192.168.1.39:18080/cangzhou.398647/tileset.json', {}, { groundheight: 5 }, 0, true, function (data) {
        //var url = "./static/ybp.gltf";
        var url = "./static/Pawns.glb";
        var position = [117.6083706437011, 38.35177486768966];
        viewData.model1 = sgworld.Creator.createModel(position.concat([6.477111566180855]), url, { scale: 0.5 }, '0', "GLTF1", function (data) {
            data.isYQ = true;
            data.lon = position[0];
            data.lat = position[1];
            data.H = 6.477111566180855;
        });
        viewData.model2 = sgworld.Creator.createModel(position.concat([11.668619598621106]), url, { scale: 0.5 }, '0', "GLTF2", function (data) {
            data.isYQ = true;
            data.lon = position[0];
            data.lat = position[1];
            data.H = 11.668619598621106;
        });
        viewData.model3 = sgworld.Creator.createModel(position.concat([17.11168368703359]), url, { scale: 0.5 }, '0', "GLTF3", function (data) {
            data.isYQ = true;
            data.lon = position[0];
            data.lat = position[1];
            data.H = 17.11168368703359;
        });
        sgworld.ProjectTree.setVisibility(viewData.model1.treeobj.id, false);
        sgworld.ProjectTree.setVisibility(viewData.model2.treeobj.id, false);
        sgworld.ProjectTree.setVisibility(viewData.model3.treeobj.id, false);
    });
})
